package com.dzk.cp.c11x5.index.q3.l012.yl;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.dzk.cp.c11x5.index.BaseC11x5Index;
import com.dzk.cp.c11x5.pojo.R5;
import com.dzk.cp.c11x5.util.SpringBeanUtils;

public abstract class Q3LxxxYLIndex extends BaseC11x5Index {
	
	private String xxx;
	
	protected Q3LxxxYLIndex setParams(int code, int num, int unit, String xxx) {
		super.setParams(code, num, unit);
		this.xxx = xxx;
		return this;
	}

	@Override
	public Map<?, Integer> index() {
		Map<Integer, Integer> resultMap = new LinkedHashMap<Integer, Integer>();
		int n = getLastestNum();
		List<? extends R5> r5s = SpringBeanUtils.getR5Service(code).queryLatest(n);
		int i = -1, j = 0, k = 0;
		for (; k < n; k++) {
			R5 r5 = r5s.get(k);
			if (r5.getN1() % 3 == xxx.charAt(0) - 48 && r5.getN2() % 3 == xxx.charAt(1) - 48 && r5.getN3() % 3 == xxx.charAt(2) - 48) {
				resultMap.put(++j, k - i - 1);
				i = k;
			}
		}
		resultMap.put(++j, k - 1 - i);
		return resultMap;
	}
	
	public static Q3LxxxYLIndex getInstance(int code, int num, int unit, String xxx) {
		int n = (xxx.charAt(0) - 48) * 9 + (xxx.charAt(1) - 48) * 3 + (xxx.charAt(2) - 48);
		switch (n) {
		case 0:
			return new Q2L000YLIndex().setParams(code, num, unit, xxx);
		case 1:
			return new Q2L001YLIndex().setParams(code, num, unit, xxx);
		case 2:
			return new Q2L002YLIndex().setParams(code, num, unit, xxx);
		case 3:
			return new Q2L010YLIndex().setParams(code, num, unit, xxx);
		case 4:
			return new Q2L011YLIndex().setParams(code, num, unit, xxx);
		case 5:
			return new Q2L012YLIndex().setParams(code, num, unit, xxx);
		case 6:
			return new Q2L020YLIndex().setParams(code, num, unit, xxx);
		case 7:
			return new Q2L021YLIndex().setParams(code, num, unit, xxx);
		case 8:
			return new Q2L022YLIndex().setParams(code, num, unit, xxx);
		case 9:
			return new Q2L100YLIndex().setParams(code, num, unit, xxx);
		case 10:
			return new Q2L101YLIndex().setParams(code, num, unit, xxx);
		case 11:
			return new Q2L102YLIndex().setParams(code, num, unit, xxx);
		case 12:
			return new Q2L110YLIndex().setParams(code, num, unit, xxx);
		case 13:
			return new Q2L111YLIndex().setParams(code, num, unit, xxx);
		case 14:
			return new Q2L112YLIndex().setParams(code, num, unit, xxx);
		case 15:
			return new Q2L120YLIndex().setParams(code, num, unit, xxx);
		case 16:
			return new Q2L121YLIndex().setParams(code, num, unit, xxx);
		case 17:
			return new Q2L122YLIndex().setParams(code, num, unit, xxx);
		case 18:
			return new Q2L200YLIndex().setParams(code, num, unit, xxx);
		case 19:
			return new Q2L201YLIndex().setParams(code, num, unit, xxx);
		case 20:
			return new Q2L202YLIndex().setParams(code, num, unit, xxx);
		case 21:
			return new Q2L210YLIndex().setParams(code, num, unit, xxx);
		case 22:
			return new Q2L211YLIndex().setParams(code, num, unit, xxx);
		case 23:
			return new Q2L212YLIndex().setParams(code, num, unit, xxx);
		case 24:
			return new Q2L220YLIndex().setParams(code, num, unit, xxx);
		case 25:
			return new Q2L221YLIndex().setParams(code, num, unit, xxx);
		case 26:
			return new Q2L222YLIndex().setParams(code, num, unit, xxx);
		default:
			return null;
		}
	}

}

class Q2L000YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 6;
	}
	
}

class Q2L001YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L002YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L010YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L011YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L012YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L020YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L021YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L022YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L100YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L101YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L102YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L110YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L111YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L112YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L120YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L121YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L122YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L200YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}

class Q2L201YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L202YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L210YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L211YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L212YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L220YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 36;
	}
	
}

class Q2L221YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 48;
	}
	
}

class Q2L222YLIndex extends Q3LxxxYLIndex {

	@Override
	protected int getZQ() {
		return 990 / 24;
	}
	
}
